package o;

import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.ui.framework.activity.AbstractBaseActivity;
import com.huawei.appgallery.foundation.ui.framework.widget.dialog.dialogactivity.DialogActivity.a;
import com.huawei.appmarket.R;

public class dgl implements eqn {
    private Context ˊ;
    private int ˋ = 0;
    private Handler ॱ = new Handler();

    private dgl(Context context) {
        this.ˊ = context;
        AbstractBaseActivity.ˏ(new 1(this));
    }

    private void ˊ(Activity activity) {
        Logger.ˎ("StoreFlowObserver", "checkProtocol");
        if (UserSession.getInstance().isLoginSuccessful()) {
            this.ॱ.post(new b(activity));
            return;
        }
        Logger.ˎ("StoreFlowObserver", "checkProtocol skipped, not login");
    }

    public static void ˊ(Context context) {
        eqq.ˋ().ˎ("StoreFlowObserver", new dgl(context));
    }

    public void onResult(int i) {
        Logger.ˎ("GLOBAL_START_FLOW", "StoreFlowObserver onResult " + i);
        if (i == 202) {
            Activity ʻॱ = AbstractBaseActivity.ʻॱ();
            if (ʻॱ != null) {
                this.ॱ.post(new b(ʻॱ));
                return;
            }
            Logger.ˎ("StoreFlowObserver", "StoreFlowObserver ProtocolStatusReporter  BuoyWindowManager");
            this.ॱ.post(new e(null));
        } else if (201 == i) {
            dgh.ˏ();
            ekg.ॱ().ˏ();
            dvt.ˏ().ˋ(1);
            diu.ˊ().ॱ();
            ((bod) bkt.ˋ("DynamicCore", bod.class)).ˎ();
            dhq.ॱ().ˊ();
            euf.ˎ().ॱॱ();
            egv.ॱᐝ().ˏॱ();
            egn.ˎ().ॱ();
            eec.ˊ().ˏ();
            Activity ʻॱ2 = AbstractBaseActivity.ʻॱ();
            if (ʻॱ2 != null) {
                Logger.ˎ("StoreFlowObserver", "[global]  homeCountry onChange");
                if (ʻॱ2 instanceof dit) {
                    this.ˋ = ((dit) ʻॱ2).ˊ();
                } else {
                    this.ˋ = dgm.ˎ(ʻॱ2);
                }
                ˋ(ʻॱ2);
                return;
            }
            Logger.ˎ("GLOBAL_START_FLOW", "StoreFlowObserver homeCountry onChange activity background");
            dzv.ˊ();
        }
    }

    private void ˋ(Activity activity) {
        Logger.ˎ("GLOBAL_START_FLOW", "StoreFlowObserver showChangDlg");
        if (Looper.myLooper() != Looper.getMainLooper()) {
            new Handler(Looper.getMainLooper()).post(new 3(this, activity));
            return;
        }
        String ˊ = eqp.ˊ();
        new a(activity, "HomeCountryChangeDialog").ॱ(activity.getString(R.string.hispace_global_protocol_switch_new, new Object[]{ˊ})).ˊ(-2, 8).ˏ(new c(this, activity)).ˋ(-1, (int) R.string.exit_confirm).ॱ(false).ˎ();
    }

    private void ˋ(Context context) {
        Logger.ˎ("StoreFlowObserver", "StoreFlowObservershowProtocol");
        diu.ˊ().ॱ((Activity) context, true, new 2(this));
    }

    private void ˊ() {
        String str = "app_market";
        if (this.ˋ == 17) {
            str = "app_child";
        } else if (this.ˋ == 18) {
            str = "app_edu";
        } else if (this.ˋ == 4) {
            str = "app_buoy";
        }
        dzv.ˊ(str);
    }
}
